﻿using ConfExpert.Forms.Base;
using DevTeam;
using System;
using System.Drawing;
using System.Windows.Forms;

namespace ConfExpert.Forms.Depo
{
    public partial class _BedenEtiketiDagilimi : XForm
    {
        public _BedenEtiketiDagilimi()
        {
            InitializeComponent();
        }

        BindingSource bsBedenEtiketi;
        private void BedenEtiketiDagilimi_Load(object sender, EventArgs e)
        {
            //TAM.xBedenEtiketDagilimTableAdapter = new Datasets.MyDataTableAdapters.xBedenEtiketDagilimTableAdapter();
            //TAM.xBedenEtiketDagilimTableAdapter.Fill(ds.xBedenEtiketDagilim);            
            
            bsBedenEtiketi = new BindingSource(ds, "xBedenEtiketDagilim");
            InitGridView(gvBedenEtiketleri, bsBedenEtiketi);

            AddBsToList(bsBedenEtiketi);

            gvBedenEtiketleri.BestFitColumns();

            gvBedenEtiketleri.AddSummary("Beden");

            gvBedenEtiketleri.RowCellStyle += new DevExpress.XtraGrid.Views.Grid.RowCellStyleEventHandler(gvBedenEtiketleri_RowCellStyle);
            btnSave.ItemClick += btnSave_ItemClick;
        }

        void btnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Save();
        }

        void gvBedenEtiketleri_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
        {
            if (e.Column.FieldName.StartsWith("Beden") || e.Column.FieldName.StartsWith("Dagilim"))
                e.Column.AppearanceCell.BackColor = Color.LightYellow;
        }
    }
}